<?php
require_once $_SERVER['DOCUMENT_ROOT']."/crc/geral/uteis/imports.php";
require_once $_SERVER['DOCUMENT_ROOT']."/crc/controle/iHistoricoControler.php";

class HistoricoControler implements iHistoricoControler{
	private $historicoDao;

	public function HistoricoControler(){	
		require_once $_SERVER['DOCUMENT_ROOT']."/crc/persistencia/dao/HistoricoDao.php";
		$this->historicoDao = new HistoricoDao();
	}	
	
	public function listarHistorico($idCasa, $limite){
		return $this->historicoDao->listarHistorico($idCasa, $limite);		
	}
	
	public function cadastrarHistorico(){
		require_once $_SERVER['DOCUMENT_ROOT']."/crc/geral/uteis/imports.php";
		require_once $_SERVER['DOCUMENT_ROOT']."/crc/modelo/Historico.php";

		$novoHistorico = new Historico();
		
		$data = antiInjection($historico->getData());
		$descricao = antiInjection($historico->getDescricao());
		$status = antiInjection($historico->getStatus());
		$idCasa = antiInjection($historico->getIdCasa());
		
		$novoHistorico->setData($data);
		$novoHistorico->setDescricao($descricao);
		$novoHistorico->setStatus($status);
		$novoHistorico->setIdCasa($idCasa);

		return $this->historicoDao->inserirHistorico($novoHistorico);
	}

}
?>